package com.hxut.config;

import org.springframework.context.annotation.Bean;
import org.springframework.session.web.http.CookieSerializer;
import org.springframework.session.web.http.DefaultCookieSerializer;

/**
 * description: CookieSerializerConfiguration
 * date: 2022/5/28 13:25
 * author: MR.孙
 */
public class CookieSerializerConfiguration {

    @Bean
    public CookieSerializer cookieSerializer(){
        //默认Cookie序列化
        DefaultCookieSerializer defaultCookieSerializer = new DefaultCookieSerializer();

        //cookie名字，默认为session
        defaultCookieSerializer.setCookieName("SESSION");

        //域,这运行跨子域共享cookie，默认配置是使用当前域
        defaultCookieSerializer.setDomainName("com.hxut");

        //cookie的路径
        defaultCookieSerializer.setCookiePath("/");

        return defaultCookieSerializer;

    }
}
